<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class TypePost_Model extends CI_Model{
	protected $_name = "type_post";
	protected $_primary = "TpId";
	var $Name_vn = "Name_vn", $Name_en = "Name_en", $Description_vn = "Description_vn", $Description_en = "Description_en", $Status = "Status";
	
	function getByTpIdTypePost($TpId){
		$this->db->where($this->_primary, $TpId);
		$this->db->where($this->Status, 1);
		$query = $this->db->get($this->_name);
		return $query->row();
	}
	function getFirstTypePost(){
		$this->db->order_by($this->_primary, "ASC");
		$query = $this->db->get($this->_name, 1,0);
		return $query->row();
	}
	function getAllTypePost(){
		$this->db->where($this->Status, 1);
		$this->db->order_by($this->_primary, "ASC");
		$query = $this->db->get($this->_name);
		return $query->result();
	}
	
}